function [x]=bandsolver(a,b,m1,m2)

% [x]=bandsolver(a,b,m1,m2)
%
% band solver with LU decomposition, forward and back substitution to
% solve the equation "a x = b"
%
% a - the band form of the matrix
% b - the rhs of the equation
% m1 - number of subdiagonals filled
% m2 - number of superdiagonals filled
%
% x - the solution to (al a)^-1 b = x
%
%
% This will solve the equation system Ax=b where A is a banded nxn
% matrix with m1 subdiagonals filled and m2 superdiagonals filled.
%
% If you were wanting to do the (simple 4x4) matrix,
% A = [1 2 0 0 ]
%     [3 4 5 0 ]
%     [0 6 7 8 ]
%     [0 0 9 10]
%
% (In matlab notation the above matrix would be the following:
% A = [1 2 0 0;3 4 5 0;0 6 7 8;0 0 9 10])
%
% you would pass it in as
% A = [0 1 2 ]
%     [3 4 5 ]
%     [6 7 8 ]
%     [9 10 0]
% (in matlab notation: A = [0 1 2;3 4 5;6 7 8;9 10 0]
%
% it would then have the following properties:
% n = 4
% m1 = 1
% m2 = 1
%
% b would be passed in as a regular vector, and x will be passed out
% as a regular vector as well.
%

% Note: The above is an example of good documentation and better
% documentation will help you get better grades because your code
% will be more understandable.


[a,al,d,indx]=bandec(a,m1,m2);
[x] = banbks(a,m1,m2,al,indx,b);